# -*- coding: utf-8 -*-
# @Author	: brotherbaby
# @Date		: 2023/10/25 10:11
# @Last Modified by:   brotherbaby
# @Last Modified time: 2023/10/25 10:11
# Thanks for your comments!

from sqlalchemy import Column, Integer, ForeignKey

from src.consts import ModelName
from src.db_proxy.models.modelbase import ModelBase, ModifyingBehevior
from src.db_proxy.models.permission import Permission


class RoleAssignment(ModelBase, ModifyingBehevior):
    __tablename__ = ModelName.RoleAssignment.value

    id = Column('id', Integer, primary_key=True, autoincrement=True)
    role_id = Column('role_id', Integer, index=True)
    permission_id = Column('permission_id', Integer, ForeignKey(Permission.__tablename__ + '.' + Permission.id.name),
                           index=True)
